<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/main.css" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/common.css" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/bootstrap.min.css" />
<!--    <link href="//cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet">
    <script src="//cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.min.js"></script>-->
    <![endif]-->
    <title>新增录入</title>
</head>
<body>
<div class="contant">
    <div class="row">
        <form id="registerForm" action="<?php echo U('add');?>"  method="post" enctype="multipart/form-data" class="form-horizontal">
            <div class="content addapply">
                <div class="box larg-box">
                    <h1>新增录入<span>(标*为必填项)</span></h1>
                    <div class="list-block">
                        <div class="row form-group" >
                            <input id="status" type="hidden" name="check_status">
                            <input id="user_id" type="hidden" name="user_id" value=<?php echo ($userInfo["id"]); ?>>
                            <label><i class="required">*</i>姓名: </label>
                            <input class="myCss col-sm-2" type="text" name="user_name" id="user_name" value=<?php echo ($userInfo["user_name"]); ?>>
                            <label><i class="required">*</i>身份证号: </label>
                            <input id="identity_no" style="width: 200px;" class="myCss col-sm-2" type="text" name="identity_no" value=<?php echo ($userInfo["identity_no"]); ?>>
                        </div>

                        <div class="row form-group">
                            <label><i class="required">*</i>业务类型: </label>
                            <select name="business_type">
                                <?php if(is_array($businessTypes)): foreach($businessTypes as $key=>$val): if($key == $carInfo['business_type']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                        <?php else: ?>
                                        <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                            </select>
                            <label><i class="required">*</i>车辆性质： </label>
                            <select name="models_form">
                                <?php if(is_array($carModelItems)): foreach($carModelItems as $key=>$val): if($key == $carInfo['models_form']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                        <?php else: ?>
                                        <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                            </select>
                            <label><i class="required">*</i>上牌类型： </label>
                            <select name="license_type">
                                <?php if(is_array($onCardItems)): foreach($onCardItems as $key=>$val): if($key == $carInfo['license_type']): ?><option value=<?php echo ($key); ?> selected><?php echo ($val); ?></option>
                                        <?php else: ?>
                                        <option value=<?php echo ($key); ?>><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
                            </select>
                        </div>
                        <div class="row form-group">
                            <label><i class="required">*</i>贷款银行: </label>
                            <select name="loan_bank_id" style="width: 300px;">
                                <?php if(is_array($bankList)): foreach($bankList as $key=>$ss): if($key == 1): ?><option value=<?php echo ($ss["id"]); ?> selected><?php echo ($ss["bank_name"]); ?></option>
                                        <?php else: ?>
                                        <option value=<?php echo ($ss["id"]); ?>><?php echo ($ss["bank_name"]); ?></option><?php endif; endforeach; endif; ?>
                            </select>
                            <label><i class="required">*</i>主贷人手机号: </label>
                            <input id="telephone" class="myCss" type="text" name="telephone" value="<?php echo ($userInfo["telephone"]); ?>">
                        </div>
                        <div class="row">
                            <label><i class="required">*</i>上传照片: </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="identity_photo_pros" accept="image/*" type="file" style="display: none"/><i>身份证正面</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="identity_photo_cons" accept="image/*" type="file" style="display: none"/><i>身份证反面</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="credit_authorize_photo" accept="image/*" type="file" style="display: none"/><i>提交征信授权书</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="credit_authorize_up" accept="image/*" type="file" style="display: none"/><i>征信授权书抬头照</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <!--<label class="inputfile" for="">-->
                            <!--<input class="upload" name="credit_authorize_down" accept="image/*" type="file" style="display: none"/><i>征信授权书低头照</i>-->
                            <!--<img class="pic" src="/Public/Common/images/default_upload.png-->
                            <!--</label>-->
                            <label class="inputfile" for="">
                                <input class="upload" name="table_credit_photo" accept="image/*" type="file" style="display: none"/><i>手写贷款额照片</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                        </div>
                        <div class="row">
                            <label><i class="required">*</i>配偶姓名: </label>
                            <input type="text" name="spouse_name" class="myCss col-sm-2">
                            <label><i class="required">*</i>身份证号: </label>
                            <input type="text" name="spouse_identity_no" style="width: 200px;" class="myCss col-sm-2">
                            <label><i class="required">*</i>配偶手机: </label>
                            <input id="spouse_telephone" class="myCss" type="text" name="spouse_telephone" value="<?php echo ($userInfo["spouse_telephone"]); ?>">
                        </div>
                        <div class="row">
                            <label><i class="required">*</i>上传照片: </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="spouse_id_photo_pros" accept="image/*" type="file" style="display: none"/><i>身份证正面</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="spouse_id_photo_cons" accept="image/*" type="file" style="display: none"/><i>身份证反面</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="spouse_credit_photo" accept="image/*" type="file" style="display: none"/><i>提交征信授权书</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                            <label class="inputfile" for="">
                                <input class="upload" name="spouse_credit_up" accept="image/*" type="file" style="display: none"/><i>征信授权书抬头照</i>
                                <img class="pic" src="/Public/Admin/images/default_upload.png" >
                            </label>
                        </div>

                        <div class="box">
                            <div class="list-block">
                                <input id="sub-frm" type="button" class="button01" value="提交" name="">
                                <input id="non-sub" type="button" class="button01" value="保存不提交" name="">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
    <style type="text/css">
        i{cursor: pointer;}
        .pic{
            width:138px;
            height:118px;
            border-radius:0% ;
            cursor: pointer;
            background: #fff;
            /*position: absolute;
            */z-index: 1;
        }
    </style>
<script type="text/javascript" src="/Public/Admin/extend/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript">
        $('#non-sub').click(function(){
            $('#status').val(-5);
            $('#registerForm').submit();
        });

        $('#sub-frm').click(function(){
            $('#status').val(-4);
            $.ajax({
                type: "POST",
                url: "/index.php?s=/Admin/Apply/validate",
                data: {
                    identity_no:$('#identity_no').val(),
                    spouse_name:$('#spouse_name').val(),
                    spouse_identity_no:$('#spouse_identity_no').val()
                },
                success: function(data){
                    console.log(data);
                    if (data.status==0) {
                        $('#registerForm').submit();
                    }else {
                        layer.msg(data.info,{icon:6,time:1000});
                    }
                    // return true;
                },
                error:function (XmlHttpRequest, textStatus, errorThrown) {
                    layer.msg('error!',{icon:5,time:1000});
                }
            });
        });

        $(function() {
            $("i").click(function (elm) {

                $(this).siblings('.upload').click();//隐藏了input:file样式后，点击头像就可以本地上传
                $(this).siblings('.upload').on("change",function(){
                    var objUrl = getObjectURL(this.files[0]) ; //获取图片的路径，该路径不是图片在本地的路径
                    if (objUrl) {
                        $(this).siblings('.pic').attr("src", objUrl) ; //将图片路径存入src中，显示出图片
                    }
                });
            });
        });

        //建立一個可存取到該file的url
        function getObjectURL(file) {
            var url = null ;
            if (window.createObjectURL!=undefined) { // basic
                url = window.createObjectURL(file) ;
            } else if (window.URL!=undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file) ;
            } else if (window.webkitURL!=undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file) ;
            }
            return url ;
        }
    </script>
<!-- 上传插件 -->
<script src="/Public/Admin/js/imgUp.js"></script>
</body>
</html>